<html>
<head><meta charset="utf-8"><title>Terminology for statically checking `const` bodies · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Terminology.20for.20statically.20checking.20.60const.60.20bodies.html">Terminology for statically checking `const` bodies</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="178486523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Terminology%20for%20statically%20checking%20%60const%60%20bodies/near/178486523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Terminology.20for.20statically.20checking.20.60const.60.20bodies.html#178486523">(Oct 18 2019 at 15:48)</a>:</h4>
<p>I've proposed some standard terminology for promotion in <a href="https://github.com/rust-rfcs/const-eval/issues/28" target="_blank" title="https://github.com/rust-rfcs/const-eval/issues/28">rust-rfcs/const-eval#28</a>. I've also been calling the code I wrote that checks the body of a <code>const</code> for illegal operations <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/check_consts/validation.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/check_consts/validation.rs">"validation"</a>. However, <a href="https://github.com/rust-lang/rust/pull/65485#issuecomment-543077808" target="_blank" title="https://github.com/rust-lang/rust/pull/65485#issuecomment-543077808">I learned yesterday</a> that MIRI refers to its dynamic checks for const-safety and UB as "validation" as well.</p>
<p>I'd like to call the static validation "const checking" everywhere and continue to refer to the dynamic part as validation. It would be clearer to call one "static validation" and the other "dynamic validation", but people inevitably drop the prefix.</p>



<a name="178537205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Terminology%20for%20statically%20checking%20%60const%60%20bodies/near/178537205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Terminology.20for.20statically.20checking.20.60const.60.20bodies.html#178537205">(Oct 19 2019 at 09:08)</a>:</h4>
<blockquote>
<p>MIRI refers to its dynamic checks for const-safety and UB as "validation" as well.</p>
</blockquote>
<p>not just const-safety -- this is checking "validity" in <a href="https://www.ralfj.de/blog/2018/08/22/two-kinds-of-invariants.html" target="_blank" title="https://www.ralfj.de/blog/2018/08/22/two-kinds-of-invariants.html">the sense I defined here</a></p>



<a name="178537209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Terminology%20for%20statically%20checking%20%60const%60%20bodies/near/178537209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Terminology.20for.20statically.20checking.20.60const.60.20bodies.html#178537209">(Oct 19 2019 at 09:08)</a>:</h4>
<p>we use this both for const-safety of the final value of a <code>const</code>, but also in stand-alone Miri to check every value we ever see and make sure it satisfies its validity invariant</p>



<a name="178537269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Terminology%20for%20statically%20checking%20%60const%60%20bodies/near/178537269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Terminology.20for.20statically.20checking.20.60const.60.20bodies.html#178537269">(Oct 19 2019 at 09:10)</a>:</h4>
<blockquote>
<p>I'd like to call the static validation "const checking" everywhere</p>
</blockquote>
<p>SGTM.</p>
<blockquote>
<p>and continue to refer to the dynamic part as validation.</p>
</blockquote>
<p>validtion in Miri is specifically about the validity invariant and related notions -- it's "checking a thing on values".<br>
the dynamic part of const checking is more than that, e.g. we have a dynamic check to make sure we only execute <code>const</code> functions during CTFE (and with <code>-Zunleash-miri</code> that check could actually kick in... do we have a test for that?)</p>



<a name="178537274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Terminology%20for%20statically%20checking%20%60const%60%20bodies/near/178537274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Terminology.20for.20statically.20checking.20.60const.60.20bodies.html#178537274">(Oct 19 2019 at 09:10)</a>:</h4>
<p>looks like we don't... adding one^^</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>